package com.zbl.zblproject.core.config;

import com.zbl.zblproject.core.entity.SnowFlake;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author youlanqiang
 * @version 1.0
 * @date 2018/12/4
 */
@Configuration
public class BeanConfig {

    @Value("${datacenter}")
    private int datacenterId;

    @Bean
    public SnowFlake snowFlake(){
        System.out.println("datacenterId:" + datacenterId);
        return new SnowFlake(datacenterId,1);
    }
}
